/*
* This file is part of QSerialDevice, an open-source cross-platform library
* Copyright (C) 2009  Denis Shienkov
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* Contact Denis Shienkov:
*          e-mail: <scapig2@yandex.ru>
*             ICQ: 321789831
*/

#ifndef SERIALNOTIFIER_H
#define SERIALNOTIFIER_H

#include <QtCore/QObject>

class SerialNotifierPrivate;
class SerialNotifier : public QObject
{
    Q_OBJECT

Q_SIGNALS:
    void activated();

public:
    enum Type { Read, Write, Exception, CTS, DSR, Ring };

    explicit SerialNotifier(Qt::HANDLE descriptor, Type type, QObject *parent = 0);
    virtual ~SerialNotifier();

    Qt::HANDLE descriptor() const;
    Type type() const;
    bool isEnabled() const;

public Q_SLOTS:
    void setEnabled(bool enable);

protected:
    SerialNotifierPrivate * const d_ptr;

private:
    Q_DECLARE_PRIVATE(SerialNotifier)
    Q_DISABLE_COPY(SerialNotifier)
    Q_PRIVATE_SLOT(d_func(), void _q_updateNotifier())
};

#endif // SERIALNOTIFIER_H
